/** 缩略图点击事件 */

import { Draw } from "../../../Draw/Draw";

export function thumbClick(e: Event, draw: Draw) {
  e.stopPropagation();
  let box = <HTMLElement>e.target;
  // 判断 box 是否为 span、image
  if (["SPAN", "IMG"].includes(box.tagName)) box = box.parentElement!;
  if (box.classList.contains("imageBox")) box = box.parentElement!;
  const index = parseInt(box.dataset.index!);
  draw.getLayerManager().switchLayer(index);
}
